package com.xcm.dao;

import com.github.pagehelper.Page;
import com.xcm.model.TbDeviceUpgrade;
import com.xcm.model.dto.DeviceUpgradeListDTO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 终端升级Mapper
 */
public interface DeviceUpgradeMapper {
	/**
	 * 通过对应机型获取终端升级
	 * getDeviceUpgradeByModel
	 *
	 * @param model 对应机型
	 * @return TbDeviceUpgrade
	 */
	TbDeviceUpgrade getDeviceUpgradeByModel(String model);

	/**
	 * 通过mac取终端升级
	 * getDeviceUpgradeByMac
	 *
	 * @param mac mac地址
	 * @return TbDeviceUpgrade
	 */
	TbDeviceUpgrade getDeviceUpgradeByMac(String mac);

	/**
	 * 保存终端升级
	 *
	 * @param deviceUpgrade TbDeviceUpgrade对象
	 */
	void saveDeviceUpgrade(TbDeviceUpgrade deviceUpgrade);

	/**
	 * 更新是否删除
	 *
	 * @param deviceUpgradeIdArray 终端ID数组
	 * @param isDelete             (1:删除；0：可用)
	 */
	void updateIsdeleteBatch(@Param("deviceUpgradeIdArray") String[] deviceUpgradeIdArray, @Param("isDelete") Integer isDelete);

	/**
	 * 更新强制升级
	 *
	 * @param deviceUpgradeId 终端升级ID
	 * @param active          是否删除       (1强制升级;0不强制)
	 */
	void updateActive(@Param("deviceUpgradeId") Long deviceUpgradeId, @Param("active") Integer active, @Param("updateTime") Long updateTime);

	/**
	 * 获取终端升级分页列表
	 *
	 * @param iSdelete 是否删除(1:删除；0：可用)
	 * @param model    对应机型
	 * @return Page<TbDeviceUpgrade>
	 */
	Page<DeviceUpgradeListDTO> listDeviceUpgradeByPage(@Param("iSdelete") Integer iSdelete, @Param("model") String model);

	/**
	 * 获取所有版本号
	 *
	 * @return List<String>
	 */
	List<String> listAllVersionCode();

	/**
	 * 通过ID获取终端升级
	 *
	 * @param deviceUpgradeId 终端升级ID
	 * @return TbDeviceUpgrade
	 */
	TbDeviceUpgrade getDeviceUpgradeById(Long deviceUpgradeId);

	/**
	 * 更新终端升级
	 *
	 * @param deviceUpgrade TbDeviceUpgrade
	 */
	void updateDeviceUpgrade(TbDeviceUpgrade deviceUpgrade);

}
